package com.flymobi.admin;

import java.util.List;

import com.flymobi.fw.modules.SM;
import com.flymobi.po.Manager;
import com.flymobi.po.PindaoRule;
import com.flymobi.po.RemotePindao;
import com.flymobi.util.C;
import com.flymobi.util.WebContext;

/**
 * 
 * 
 * Title:
 * 
 * Description:
 * 
 * Copyright: Copyright (c) 2008
 * 
 * @author haoxz11
 * @created Oct 21, 2008 11:16:42 AM
 * @version $Id: SysPowerAction.java,v 1.1 2010/04/09 03:27:08 airsou Exp $
 */
public class PindaoRuleAction extends WebAction {

	/**
	 * Comment for <code>serialVersionUID</code>
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public String webProcess(WebContext context, Manager manager) {
		if ("list".equals(method)) {
			List<RemotePindao> pindaoList = SM.RemotePindaoService.list();
			for (RemotePindao p : pindaoList) {
				p.setPindaoId(new Long(id));
			}
			context.put("pindaoList", pindaoList);
			return "list";
		} else if ("save".equals(method)) {
			SM.PindaoRuleService.deleteByPindaoId(new Long(id));
			if (selItems != null) {
				for (String idx : selItems) {
					PindaoRule pindaoRule = new PindaoRule();
					pindaoRule.setPindaoId(new Long(id));
					pindaoRule.setRemoteId(new Long(idx));
					SM.PindaoRuleService.save(pindaoRule);
				}
			}
			context.put("rmsg", C.TEXT.SAVE_SUCCESS);
			return "listpindao";
		} else {
			method = "list";
			return this.webProcess(context, manager);
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.camel.admin.WebAction#getSysLog()
	 */
	@Override
	public String getSysLog() {
		// TODO Auto-generated method stub
		return null;
	}
}
